﻿using System;
using System.Collections.Generic;
using System.Text;

namespace UtilZ.Dotnet.Ex.Communication.Net.Telnet.Commands
{
    /// <summary>
    /// 命令基类
    /// </summary>
    public abstract class TelnetCommandAbs : ITelnetCommand
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public TelnetCommandAbs()
        {

        }

        /// <summary>
        /// 执行命令[执行成功返回true;否则返回false]
        /// </summary>
        /// <param name="telnetClient">执行命令的连接</param>
        /// <param name="paraArr">命令参数</param>
        /// <returns>执行结果</returns>
        public bool Excute(IListenTelnetClient telnetClient, string[] paraArr)
        {
            return this.PrimitiveExcute(telnetClient, paraArr);
        }

        /// <summary>
        /// 执行命令[执行成功返回true;否则返回false]
        /// </summary>
        /// <param name="telnetClient">执行命令的连接</param>
        /// <param name="paraArr">命令参数</param>
        /// <returns>执行结果</returns>
        protected abstract bool PrimitiveExcute(IListenTelnetClient telnetClient, string[] paraArr);
    }
}
